﻿using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Path的练习
{
    internal class Program
    {
        static void Main(string[] args)
        {
            string path = @"D:\test\config\config.txt";

            //static string GetDirectoryName(string path)
            //获取路径中的目录路径
            Console.WriteLine(Path.GetDirectoryName(path));

            //static string GetFileName(string path)
            //获取路径中的文件名（文件名.后缀名）
            Console.WriteLine(Path.GetFileName(path));

            //static string GetExtension(string path)
            //获取路径中的文件后缀
            Console.WriteLine(Path.GetExtension(path));

            //static string GetFileNameWithoutExtension(string path)
            //获取路径中的文件，但不包含后缀
            Console.WriteLine(Path.GetFileNameWithoutExtension(path));

            //static string Combine(string path, string path)
            //将字符串拼接为路径
            string path1 = @"D:\text\";
            string path2 = @"config\config.txt";
            Console.WriteLine(Path.Combine(path1, path2));

        }
    }
}